On the Subject of Lines of Code
“Okay, we’ve got Lines of Code.” “Uh... how’d you hack into the mainframe?”
This module consists of a display with some *C# code on it, and a keypad which consists of 10 number buttons, a negative sign button, a backspace button, and a enter button. To solve the module, enter a number that will modify the code in such a way that the module solves. However, if you enter a number that will modify the code in such a way that a strike will occur, the module will strike.
Use the table below to determine what each line of code means. Note that when a variable gets assigned a new value, it overwrites the old value. Lines of code are run from top to bottom. So all lines above a particular line must run first, and all lines below that line must run after.
Code: | Meaning: |
int n = 0; | The integer variable ‘n’ gets assigned the value of 0. Integers cannot have any decimal points, so if a result has any decimals, you simply remove them. If the name on the left side is ‘n’, the number on the right side of the equation is the number which can be modified and entered using the keypad, all other value names cannot be modified. |
x = y; | The variable ‘x’ gets assigned the value of ‘y’. |
x = y + z; | The variable ‘x’ gets assigned the value of the sum of ‘y’ and ‘z’. |
x = y - z; | The variable ‘x’ gets assigned the value of the difference of ‘y’ and ‘z’ (specifically, ‘y’ minus ‘z’). |
x = y * z; | The variable ‘x’ gets assigned the value of the product of ‘y’ and ‘z’. |
x = y / z; | The variable ‘x’ gets assigned the value of the quotient of ‘y’ and ‘z’ (specifically, ‘y’ divided by ‘z’). |
x = y % z; | The variable ‘x’ gets assigned the value of the remainder after you divide ‘y’ by ‘z’ (Also known as modulo ‘y’ by ‘z’). |
x = y & z; | The variable ‘x’ gets assigned the value when you use an AND gate for inputs ‘y’ and ‘z’. |
x = y | z; | The variable ‘x’ gets assigned the value when you use an OR gate for inputs ‘y’ and ‘z’. |
* A reference for C# can be found here:
https://en.wikipedia.org/wiki/C_Sharp_(programming_language)